Repository navigation
feat(toolchains): discover JDKs on fixed Windows drives - #52
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
There was a problem hiding this comment.
Note
Newer findings are available below. Devin Review posted a newer report on this PR, in addition to the findings presented here.
Devin Review found 2 findings. Devin was interrupted while fixing; 2 findings are left for you to triage below.
| let workspace_root = workspace.map(|workspace| { | ||
| let root = PathBuf::from(&workspace.root); | ||
| dunce::canonicalize(&root).unwrap_or(root) | ||
| }); |
There was a problem hiding this comment.
🔴 Open workspace blocks toolchain settings
When an open workspace contains a scanned JDK, scan_drives still reports it to the global picker. The global query omits workspace, but the host passes all open roots to Core’s reply decoder. Core rejects the entire reply, so Toolchains settings fail to load.
Learn more
The provider sees only the optional workspace in its query, and global queries have none. The pinned desktop host’s settingsToolchains.LoadScope calls ToolchainOptions, which supplies all open roots even for global scope. ProviderClient.capture passes those roots to Core’s decodeReply. Core rejects the entire reply when checked_installation_detail finds an installation under any of those roots, and prepareTool propagates the error instead of loading the other toolchains. The same mismatch applies to project queries when the installation is under a different open root.
Example: Open D:\ as a workspace on a machine with D:\Program Files\Java\jdk-21. Then open global Toolchains settings. The provider includes that JDK because its query has no workspace, and Core rejects the reply instead of leaving that JDK out and listing the others.
Recommended fix: Make the host exclude installations under every open workspace root before decoding the provider reply, or extend the query contract to give the provider those roots. Keep Core’s containment check as a backstop. Cover global discovery with an open root and a reply containing both an in-root JDK and an unrelated valid JDK.
Was this helpful? React with 👍 or 👎 to provide feedback.
| let home = entry.path(); | ||
| if !home.is_dir() || !java_executable(&home).is_file() { | ||
| continue; | ||
| } | ||
| let Some(version) = release_version(&home) else { | ||
| continue; | ||
| }; |
There was a problem hiding this comment.
🟡 Standalone runtimes offered as project JDKs
scan_vendor_root accepts a standalone Zulu JRE on a secondary drive because it has java.exe and release metadata. The JDK tool exports the selected runtime as JAVA_HOME, leaving builds that need a JDK without a compiler.
Learn more
The provider scans the Zulu vendor directory without a JDK-name filter, and standalone Azul Windows JRE archives ship both bin/java.exe and a release file with JAVA_VERSION. They do not ship bin/javac.exe. The Java executable layout checks only the launcher, so a host version probe cannot distinguish this runtime from a full JDK.
Example: Extract the Windows Zulu 17 JRE archive under D:\Program Files\Zulu and select it from the JDK picker. The resulting JAVA_HOME points to an installation that can run Java but cannot supply javac to a build.
Recommended fix: Require bin/javac.exe as well as bin/java.exe before offering a Windows installation from this provider. Add a scan test with both a standalone JRE and a full JDK so the picker receives only the latter.
Was this helpful? React with 👍 or 👎 to provide feedback.
…y checks, and release parsing
Summary
Windows 用户把 JDK 安装到非系统盘的常见目录(例如
D:\Program Files\Java\jdk1.8.0_151)时,现有声明式扫描只看C:\Program Files,导致该 JDK 不进选择器。本 PR 在 Java 插件后端新增toolchainProviders版本0的installs提供方:在 Windows 枚举 fixed drives,对各盘Program Files下与现有定义一致的Java、Eclipse Adoptium、Microsoft、Zulu、Amazon Corretto、BellSoft安装根做有界扫描,从release的JAVA_VERSION读取版本并返回安装与扫描根 watch 路径。扫描只读元数据,不执行任何被发现的 Java 程序;工作区内的路径不会被报告为系统安装。插件仍使用最低可用能力版本:
backend: 0、toolchainProviders: 0。新增权限只有toolchains.provide(配合已有backend.launch),用途是回答 JDK 安装位置查询;契约、SDK 与端到端宿主基线统一提升到 Lithe Desktopdesktop-v0.8.22使用的 Corea1a792a5a3b2284720d3209b7a9c93394c365c18/ hostb62a0817d321fe4a76dfabd3d54990a65324d3c5。日志与输出边界:后端使用官方 Rust SDK;提供商不写 stdout/stderr、不记录路径或
release文件内容,缺失目录按预期缺失处理,取消通过Cancellation结束查询,扫描结果数和每个release文件读取量均有上限。功能矩阵已新增本能力;无 UI 变更,因此没有新增截图。Verification
cargo fmt --all --checkcargo clippy --workspace --all-targets --locked -- -D warningscargo test --workspace --locked(全部通过)node --test --test-timeout=60000 scripts/package/*.test.mjsnode --test --test-timeout=15000 scripts/compiler/process.test.mjsscripts/verify-sdk-lock.sh --download/ pinned schema validation(Corea1a792a5a3b2284720d3209b7a9c93394c365c18)GetDriveTypeWAPI 使用按x86_64-pc-windows-msvc做了最小编译核对;完整 Windows 后端测试由本 PR 的 Windows CI 执行未做真实 Windows 桌面端手工验收;功能矩阵保持
implemented / pending,没有声称原生端到端已验证。Link to Devin session: https://app.devin.ai/sessions/4c017f8b5c4248b4bbabcad166be2672
Open in Devin Desktop: https://app.devin.ai/desktop/session/4c017f8b5c4248b4bbabcad166be2672?variant=devin
Requested by: @1lck
🟢 Devin Review found nothing to fix · View findings · Follow Devin's work